package com.ququ.syb.business.account.controller;

import com.ququ.common.result.Result;
import com.ququ.common.result.ResultJson;
import com.ququ.syb.business.account.service.BlackListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@RestController
public class BlackListController {

    @Autowired
    private BlackListService blackListService;

    @RequestMapping("/blacklist/add")
    public ResultJson addBlackList(@RequestParam(required = false) String idcardno,
                                   @RequestParam(required = false) String mobile){
        blackListService.addBlackList(idcardno, mobile);
        return new ResultJson();
    }


    @RequestMapping("/blacklist/del")
    public ResultJson removeBlackList(@RequestParam(required = false) String idcardno,
                                   @RequestParam(required = false) String mobile){
        blackListService.removeBlackList(idcardno, mobile);
        return new ResultJson();
    }


    @RequestMapping("/blacklist/mobile")
    public Result<Boolean> isBlackListMobile(@RequestParam String mobile){
        return new Result<>(blackListService.isBlackListMobile(mobile));
    }

    @RequestMapping("/blacklist/idcard")
    public Result<Boolean> isBlackListIdcard(@RequestParam String idcardno){
        return new Result<>(blackListService.isBlackListIdcard(idcardno));
    }


    @RequestMapping("/blacklist/mobile/list")
    public Result<Set<String>> listBlackListMobile(){
        return new Result<>(blackListService.listBlackListMobile());
    }


    @RequestMapping("/blacklist/idcard/list")
    public Result<Set<String>> listBlackListIdcard(){
        return new Result<>(blackListService.listBlackListIdcard());
    }

}
